//
//  TCAllTableViewCell.m
//  Project_B
//
//  Created by dllo on 15/11/27.
//  Copyright © 2015年 张闯. All rights reserved.
//

#import "TCAllTableViewCell.h"
#import "UIImageView+WebCache.h"
#define WIDTH [[UIScreen mainScreen] bounds].size.width / 375
#define HEIGHT [[UIScreen mainScreen] bounds].size.height / 667

@interface TCAllTableViewCell ()
@property (nonatomic, strong)UIImageView *bigimage;
@property (nonatomic, strong)UIImageView *smallimage;
@property (nonatomic, strong)UILabel *namelabel;
@property (nonatomic, strong)UILabel *timelabel;
@property (nonatomic, strong)UILabel *conlabel;
@end

@implementation TCAllTableViewCell
- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
        self.bigimage = [[UIImageView alloc]init];
        self.bigimage.layer.borderWidth = 0;
        self.bigimage.layer.borderColor = [UIColor colorWithRed:60.0 / 255 green:149.0 / 255 blue:58.0 / 255 alpha:1].CGColor;
        [self.contentView addSubview:self.bigimage];
        
        self.smallimage = [[UIImageView alloc]init];
        [self.contentView addSubview:self.smallimage];
        
        self.namelabel = [[UILabel alloc]init];
        self.namelabel.textColor = [UIColor whiteColor];
        [self.namelabel setFont:[UIFont boldSystemFontOfSize:13]];
        [self.contentView addSubview:self.namelabel];
        
        self.timelabel = [[UILabel alloc]init];
        self.timelabel.textColor = [UIColor whiteColor];
        [self.timelabel setFont:[UIFont boldSystemFontOfSize:13]];
        [self.contentView addSubview:self.timelabel];
        self.conlabel = [[UILabel alloc]init];
        
        self.conlabel.textColor = [UIColor grayColor];
        [self.conlabel setFont:[UIFont systemFontOfSize:13]];
        [self.contentView addSubview:self.conlabel];
        
        UIView *view = [[UIView alloc] init];
        view.tag = 1001;
        [self.bigimage addSubview:view];
        view.backgroundColor = [UIColor blackColor];
        view.alpha = 0.1;
    }
    return self;
}
- (void)layoutSubviews
{
    [super layoutSubviews];
    self.bigimage.frame = CGRectMake(5*WIDTH, 5*HEIGHT, 365*WIDTH, 170*HEIGHT);
    self.smallimage.frame = CGRectMake(10*WIDTH, 130*HEIGHT, 35*WIDTH, 35*HEIGHT);
    self.namelabel.frame = CGRectMake(55*WIDTH, 130*HEIGHT, 150*WIDTH, 20*HEIGHT);
    self.timelabel.frame = CGRectMake(55*WIDTH, 150*HEIGHT, 250*WIDTH, 20*HEIGHT);
    self.conlabel.frame = CGRectMake(10*WIDTH, 175*HEIGHT, 355*WIDTH, 30*HEIGHT);
    UIView *view = [self viewWithTag:1001];
    view.frame = CGRectMake(0, 0, 365 * WIDTH, 170 * HEIGHT);
    
}
- (void)setDic:(NSDictionary *)dic
{
    if (self.dic != dic) {
        _dic = dic;
    }
    [self.bigimage sd_setImageWithURL:[NSURL URLWithString:dic[@"image"]] placeholderImage:[UIImage imageNamed:@"zhanwei.png"]];
    [self.smallimage sd_setImageWithURL:[NSURL URLWithString:dic[@"headicon"]] placeholderImage:[UIImage imageNamed:@"zhanwei.png"]];
    self.namelabel.text = dic[@"nickname"];
    self.timelabel.text = dic[@"createdate"];
    self.conlabel.text = dic[@"title"];
}
- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
